/*
 *
Base class x= 100
Base class x= 100
Derived class m = 10, n=20
Base class x= 200

 *
 */
#include <iostream>
using namespace std;
class Base{
	private:
		int x;
	public:
		void set(int i){
			x = i;
		}
		void print(){
			cout << "Base class " << "x= " << x << endl;
		}
};
class Derived: public Base{
	private:
		int m, n;
	public:
		void set(int p, int k){
			m = p;
			n = k;
		}
		void print(){
			Base::print();
			cout << "Derived class "<< "m = "<< m <<", n=" << n << endl;
		}
};
int main(void){

	Derived d;
	d.set(10,20);
	//d.set(100); // error  名字隐藏
	d.Base::set(100);

	d.Base::print();
	d.print();

	Derived* d1 = new Derived();
	d1->Base::set(200);
	Base * b1 = (Base *)d1;
	b1->print();
	return 0;
}
